package com.bzkj.basicinfo.service.impl;

import com.bzkj.basicinfo.domain.sys.SysBackupsPathEntity;
import com.bzkj.basicinfo.mapper.SysBackupsPathMapper;
import com.bzkj.basicinfo.service.SysBackupsPathService;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;

/**
 * @author wl
 * @description 针对表【sys_backups_path(数据备份表)】的数据库操作Service实现
 * @createDate 2025-01-17 15:43:24
 */
@Service
public class SysBackupsPathServiceImpl implements SysBackupsPathService
{
    @Autowired
    private SysBackupsPathMapper sysBackupsPathMapper;

    /**
     * 获取当前备份信息
     *
     * @return
     */
    @Override
    public R findData()
    {
        SysBackupsPathEntity one = sysBackupsPathMapper.findData();
        return R.ok(Arrays.asList(one));
    }

    /**
     * 修改备份信息
     *
     * @param entity
     * @return
     */
    @Override
    public R putData(SysBackupsPathEntity entity)
    {
        entity.setUpdateTime(new Date());
        entity.setEnableStatus(SecurityUtils.getUserId().intValue());
        sysBackupsPathMapper.putData(entity);
        return R.ok("修改成功");
    }
}




